package ltesim.editors;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

/**
 * Modify listener class for applying dirty state on form input change
 * 
 * @author xirka
 * 
 */
public class LFormModifyListener implements ModifyListener {
	LEditorPage page;

	/**
	 * Constructor
	 * 
	 * @param lEditorPage
	 */
	public LFormModifyListener(LEditorPage lEditorPage) {
		page = lEditorPage;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events
	 * .ModifyEvent)
	 */
	@Override
	public void modifyText(ModifyEvent e) {
		page.setDirty(true);
		page.firePropertyChange("dirtyState", !page.isDirty(), page.isDirty());
	}

}
